<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
<%
	String bindListJson= (String)request.getAttribute("bindListJson");
	String pageJson= (String)request.getAttribute("pageJson");
 %>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>解放军第三〇五医院</title>
<link href="${basePath}/static/css/Pigeonhole/Pigeonhole_list.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="${basePath}/static/css/medicalRecord_Search/medicalSearch.css"/>
<script type="text/javascript" src="${basePath}/static/publics/assets/jqPaginator/jqPaginator.js"></script>
</head>
<body>

<!--内容部分-->

    
    <div class="list_NR">
        <div class="loc">
            <h3>病案催收</h3>
            <ul class="loc_loc">
              	  病案归档 > 病案催收
            </ul>
        </div>
        
          <div class="list_con_table">
            <input type="hidden" value="${medBindQuery.totalCounts }" id="totalCountsHidden">
			 <form action="${basePath}/bind/unPigeonhole1" method="get" id="queryForm">
			 	<input type="hidden" value="true" name="query">
	        	<div class="search_table">
                <ul class="clearfix" style="margin-bottom:0;">
                    <li class="Label_1">出院日期：&nbsp;</li>
                    <li class="Label_2" style="width:49%;text-align:left">
                        <input style="width:175px;margin-left:5px" class="input_box" name="uploadStartDate" value='<fmt:formatDate value="${medBindQuery.uploadStartDate}" pattern="yyyy-MM-dd"/>' onFocus="WdatePicker()" type="text" > 
                        - <input style="width:175px" class="input_box" name="uploadEndDate"  value='<fmt:formatDate value="${medBindQuery.uploadEndDate}" pattern="yyyy-MM-dd"/>' onFocus="WdatePicker()" type="text" >
                    </li>
                   <%--  <li class="Label_2">

                    <input class="input_box" style="width:140px" type="text"  name="uploadStartDate" value='<fmt:formatDate value="${medBindQuery.uploadStartDate}" pattern="yyyy-MM-dd"/>' onFocus="WdatePicker()"/>&nbsp;&nbsp;—
                    </li>
                    <li class="Label_2" style="width:145px;">
                    	<input class="input_box" style="width:140px" type="text"  name="uploadEndDate"  value='<fmt:formatDate value="${medBindQuery.uploadEndDate}" pattern="yyyy-MM-dd"/>' onFocus="WdatePicker()"/>
                    </li> --%>
                   
                    <li class="Label_1">身份证号：&nbsp;</li>
                    <li class="Label_2"><input class="input_box" type="text" style="width:155px;"  name="idCard" id='' value='${medBindQuery.idCard}' />
                    	 <input type="hidden" name="bindStatus" value="1"/>
                    </li>
                    
                     <li class="Label_1">识别码：&nbsp;</li>
                    <li class="Label_2" style="width:49%;text-align:left">
                    	 <input class="input_box" style="width:150px;" type="text"  name="mr_id" value='' />
                    </li>
                    
                    <li class="Label_1" >出院科室：&nbsp;</li>
                    <li class="Label_2" >
                    
                    	<select class="input_box" style="width:140px" name="outHospitalOfficeId">
                    		<option value="">请选择</option>
                    		<c:forEach var="office" items="${offices }"> 
                    			<option <c:if test="${medBindQuery.outHospitalOfficeId==office.id}">selected="selected"</c:if> value="${office.id }">${office.name }</option>
                    		</c:forEach>
                    	
                    	</select>
                    </li>
                    
                    <li class="Label_5">
                        <div class="right">
                        	<input class="btn" type="submit" value="查询">
                        </div>
                    </li>
                </ul>
            </div>
	        </form>
			 
			 <form action="${basePath}/bind/unPigeonhole1" method="get" id="pageForm">
	        	<input type="hidden" name="currentPage" value="${medBindQuery.currentPage }" id="currentPageHidden">
	        	<input type="hidden" name="pageSize" value="${medBindQuery.pageSize }" id="pageSizeHidden">
	        	
	        	<input  type="hidden"  name="bindStatus" value='${medBindQuery.bindStatus}' />
	        	<input  type="hidden"  name="idCard" value='${medBindQuery.idCard}' />
	       	    
	       	    <input type="hidden"  name="uploadStartDate" value='<fmt:formatDate value="${medBindQuery.uploadStartDate}" pattern="yyyy-MM-dd"/>' />
                <input type="hidden"  name="uploadEndDate" value='<fmt:formatDate value="${medBindQuery.uploadEndDate}" pattern="yyyy-MM-dd"/>' />
                 <input  type="hidden"  name="outHospitalOfficeId" value='${medBindQuery.outHospitalOfficeId}' />
	        </form>

        </div>

        <table class="Search_tableList"cellpadding="0" cellspacing="0">
     
            <tr>
                <td class="tdLabel_4">姓名</td>
                <td class="tdLabel_4">身份证号</td>
                <td class="tdLabel_4">识别码</td>
                <td class="tdLabel_4">出院日期</td>
                <td class="tdLabel_4">就诊类型</td>
                <td class="tdLabel_4">所属医院</td>
                <td class="tdLabel_4">状态</td>
            </tr>
            
           
            <tbody id="tbody">
            	<%-- <c:forEach var="med" items="${bindList }">
            		<tr>
            			<td class='tdLabel_5'>
            				<div class='imgIcon'><img src='${basePath}/static/publics/images/file.png' alt=''/></div>
            			</td>
            			<td class='tdLabel_5'><fmt:formatDate value="${med.uploadDate}" pattern="yyyy-MM-dd"/></td>
            			<td class='tdLabel_5'>${med.name}</td>
            			<td class='tdLabel_5'>${med.id_number}</td>
            			<td class='tdLabel_5'>${med.treatment_no}</td>
            			<td class='tdLabel_5'><fmt:formatDate value="${med.treatment_date}" pattern="yyyy-MM-dd"/></td>
            			<td class='tdLabel_5'>${med.treatment_type_name}</td>
            			<td class='tdLabel_5'>${med.hospital_name }</td>
            			<td class='tdLabel_5'>${med.comment }</td>
            			<td class='tdLabel_5'>
            				<c:if test="${empty med.first_level_medical_guid }">
            					<a target='_blank' href='${basePath}/bind/pigeonHoleList?id=${med.id}'>绑定</a>
            				</c:if>
            				<c:if test="${not empty med.first_level_medical_guid }">
            					已绑定
            				</c:if>
            			</td>
            		</tr>
            	</c:forEach> --%>
            </tbody>
               
           
        </table>


        <div class="pageList">
            <ul class="pagination clearfix" id="page_plus"></ul>
            <div class="pagination">
                <div>总共：<b id="totalPage">0</b> 条信息    当前页是第 <b id="currentPage">0/0</b>　页</div>
            </div>
        </div>
    </div>
<!--script JS部分-->
<script type="text/javascript" src="${basePath}/static/publics/assets/jquery/jquery.min.js"></script>
<script type="text/javascript" src="${basePath}/static/publics/assets/bootstrap/js/bootstrap.js"></script>
<script type="text/javascript" src="${basePath}/static/publics/assets/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="${basePath}/static/publics/assets/jqPaginator/jqPaginator.js"></script>
<script type="text/javascript">
	$(function(){
		var data= <%=bindListJson%>;
		var page= <%=pageJson%>;
		var html ="";
		for(var i in data){
			var med=data[i];
			
			html+="<tr>"+
		                "<td class='tdLabel_5'>"+(med.name==undefined?'':med.name)+"</td>"+
		                "<td class='tdLabel_5'>"+(med.id_number==undefined?'':med.id_number)+"</td>"+
		               " <td class=tdLabel_5>"+(med.mr_id==undefined?'':med.mr_id)+"</td>"+
		               " <td class=tdLabel_5>"+(med.out_hospital_date==undefined?'':med.out_hospital_date)+"</td>"+
		                "<td class='tdLabel_5'>"+(med.treatment_type_name==undefined?'':med.treatment_type_name)+"</td>"+
		               " <td class='tdLabel_5'>"+(med.hospital_name==undefined?'':med.hospital_name)+"</td>"+
		               " <td class='tdLabel_5'><a onclick='operation(this)'>待催收</a></td>";
		               
		}
		$("#tbody").html(html);
		initPage(page);
	});
	
	function initPage(page){
		 var totalCounts = page.totalCounts;
		 var pageSize = page.pageSize;
		 var visiblePages = 5;
		 var currentPage = page.currentPage;
		 var totalPages = page.totalPages;
		 $('#page_plus').jqPaginator({

		        totalCounts: totalCounts,
		        pageSize:pageSize,
		        visiblePages: visiblePages,
		        currentPage: currentPage,

		        first:'<li class="first"><a href="javascript:void(0);">首页</a></li>',
		        prev: '<li class="prev"><a href="javascript:void(0);">上一页</a></li>',
		        next: '<li class="next"><a href="javascript:void(0);">下一页</a></li>',
		        last: '<li class="last"><a href="javascript:void(0);">末页</a></li>',
		        page: '<li class="page"><a href="javascript:void(0);">{{page}}</a></li>',
		        onPageChange: function (num,type) {

		     		if(type !='init'){
		     			$("#currentPageHidden").val(num);
						$("#pageSizeHidden").val(pageSize);
						$("#pageForm").submit();
					}
		            $("#totalPage").html(totalCounts);
		            $("#currentPage").html(num+"/"+totalPages);
		            $("#currentPageHidden").val(currentPage);
				    $("#pageSizeHidden").val(pageSize);
		        }
		    });

	}
	
	function operation(obj){
		$(obj).parents("tr").find("td").css({"color":"red"});
		$(obj).html("已催收");
	}
</script>
<!-- <script>
	$(function(){
		//var unbindList=$("#unbindList").val();
		
		var unbindSize=$("#unbindSize").val();
		init(unbindSize);
		getData(1,10);
	});
	
	//初始化分页数据
	function init(unbindSize){
		 var totalCounts = parseInt(unbindSize);
		 var pageSize = 10;
		 var visiblePages = 5;
		 var currentPage = 1;
		 var totalPages = Math.ceil(totalCounts/pageSize);
		 $('#page_plus').jqPaginator({

		        totalCounts: totalCounts,
		        pageSize:pageSize,
		        visiblePages: visiblePages,
		        currentPage: currentPage,

		        first:'<li class="first"><a href="javascript:void(0);">首页</a></li>',
		        prev: '<li class="prev"><a href="javascript:void(0);">上一页</a></li>',
		        next: '<li class="next"><a href="javascript:void(0);">下一页</a></li>',
		        last: '<li class="last"><a href="javascript:void(0);">末页</a></li>',
		        page: '<li class="page"><a href="javascript:void(0);">{{page}}</a></li>',
		        onPageChange: function (num,type) {

		     	
		            $("#totalPage").html(totalCounts);
		            $("#currentPage").html(num+"/"+totalPages);
		            getData(num,10);
		           
		        }
		    });

	}
	
	//分页查询数据
	function getData(pageNo,pageSize){
		$.ajax({
			type:"post",
			url:"${basePath}/bind/getMedData",
			data:{pageNo:pageNo,PageSize:pageSize},
			success:function(data){
				if(data!=null && data!=""){
					var html="";
					html="";
					for(var i in data){
						var med=data[i];
						
						html+="<tr><td class='tdLabel_5'><div class='imgIcon'><img src='${basePath}/static/publics/images/file.png' alt=''/></div></td>"+
		                "<td class='tdLabel_5'>"+med.uploadDate+"</td>"+
		                "<td class='tdLabel_5'></td>"+
		                "<td class='tdLabel_5'></td>"+
		               " <td class=tdLabel_5></td>"+
		                "<td class='tdLabel_5'></td>"+
		               " <td class='tdLabel_5'>"+(med.name==undefined?'':med.name)+"</td>"+
		               " <td class='tdLabel_5'>"+(med.comment==undefined?'':med.comment)+"</td>"+
		                "<td class='tdLabel_5'><a target='_blank' href='${basePath}/bind/pigeonHoleList?id="+med.id+"'>绑定</a></td></tr>";
					}
					
					$("#tbody").html(html);
				}else{
					$("#tbody").html("");
				}
				
			}
		})
	}
</script> -->
</body>
</html>